package com.acoreful.bootsample.web.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.acoreful.bootsample.dao.entity.Book;
import com.acoreful.bootsample.service.BookService;

@RestController
@RequestMapping("books")
public class BookController {
	@Autowired
	private BookService bookService;
	@GetMapping
	public ResponseEntity<List<Book>> getALlList(){
		List<Book> list=bookService.findList();
		return new ResponseEntity<List<Book>>(list, HttpStatus.OK);
	}
	
	@PostMapping
	public ResponseEntity<List<Book>> save(){
		List<Book> list=bookService.findList();
		return new ResponseEntity<List<Book>>(list, HttpStatus.OK);
	}
}
